home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 November: Tool Chest / Dev.CD Nov 00 TC Disk 2.toast / pc / sample code / sound / sndplaydoublebuffer / _headers / ulaw.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-09-28  |  3.7 KB  |  96 lines

  1. /*
  2.     File:        ULAW.h
  3.  
  4.     Contains:    Header containing the information needed to parse Sun's .au files.
  5.  
  6.     Written by: Mark Cookson    
  7.  
  8.     Copyright:    Copyright © 1996-1999 by Apple Computer, Inc., All Rights Reserved.
  9.  
  10.                 You may incorporate this Apple sample source code into your program(s) without
  11.                 restriction. This Apple sample source code has been provided "AS IS" and the
  12.                 responsibility for its operation is yours. You are not permitted to redistribute
  13.                 this Apple sample source code as "Apple sample source code" after having made
  14.                 changes. If you're going to re-distribute the source, we require that you make
  15.                 it clear in the source that the code was descended from Apple sample source
  16.                 code, but that you've made changes.
  17.  
  18.     Change History (most recent first):
  19.                 8/31/1999    Karl Groethe    Updated for Metrowerks Codewarror Pro 2.1
  20.                 
  21.  
  22. */
  23.  
  24. #ifndef __ULAW__
  25. #define __ULAW__
  26.  
  27. #include <Errors.h>
  28. #include <SoundComponents.h>
  29. #include <Types.h>
  30.  
  31. #ifndef __DBFFERRORS__
  32. #include "DBFF_Errors.h"
  33. #endif
  34.  
  35. #ifndef __SETUPDBHEADER__
  36. #include "SetupDBHeader.h"
  37. #endif
  38.  
  39. #ifndef __LDANDFIX__
  40. #include "LDandFix.h"
  41. #endif
  42.  
  43. #ifndef __DEFINES__
  44. #include "Defines.h"
  45. #endif
  46.  
  47. /* data format possibilities */
  48. #define SND_FORMAT_UNSPECIFIED                0        /* unspecified format (can't support this) */
  49. #define SND_FORMAT_MULAW_8                    1        /* 8-bit mu-law samples */
  50. #define SND_FORMAT_LINEAR_8                    2        /* 8-bit linear samples */
  51. #define SND_FORMAT_LINEAR_16                3        /* 16-bit linear samples */
  52. #define SND_FORMAT_LINEAR_24                4        /* 24-bit linear samples (can't support this) */
  53. #define SND_FORMAT_LINEAR_32                5        /* 32-bit linear samples (can't support this) */
  54. #define SND_FORMAT_FLOAT                    6        /* floating-point samples (can't support this) */
  55. #define SND_FORMAT_DOUBLE                    7        /* double-precision float samples (can't support this) */
  56. #define SND_FORMAT_INDIRECT                    8        /* fragmented sampled data (can't support this) */
  57. #define SND_FORMAT_NESTED                    9        /* ? (can't support this) */
  58. #define SND_FORMAT_DSP_CORE                    10        /* DSP program (can't support this) */
  59. #define SND_FORMAT_DSP_DATA_8                11        /* 8-bit fixed-point samples (can't support this) */
  60. #define SND_FORMAT_DSP_DATA_16                12        /* 16-bit fixed-point samples (can't support this) */
  61. #define SND_FORMAT_DSP_DATA_24                13        /* 24-bit fixed-point samples (can't support this) */
  62. #define SND_FORMAT_DSP_DATA_32                14        /* 32-bit fixed-point samples (can't support this) */
  63. #define SND_FORMAT_DISPLAY                    16        /* non-audio display data (can't support this, it isn't playable data anyway) */
  64. #define SND_FORMAT_MULAW_SQUELCH            17        /* ? (can't support this) */
  65. #define SND_FORMAT_EMPHASIZED                18        /* 16-bit linear with emphasis (can't support this) */
  66. #define SND_FORMAT_COMPRESSED                19        /* 16-bit linear with compression (can't support this) */
  67. #define SND_FORMAT_COMPRESSED_EMPHASIZED    20        /* A combination of the two above (can't support this) */
  68. #define SND_FORMAT_DSP_COMMANDS                21        /* Music Kit DSP commands (can't support this) */
  69. #define SND_FORMAT_DSP_COMMANDS_SAMPLES        22        /*  ? (can't support this) */
  70.  
  71. #if PRAGMA_ALIGN_SUPPORTED
  72. #pragma options align=mac68k
  73. #endif
  74.  
  75. typedef struct auHeader {
  76.     unsigned long            id;                    /* Should be '.snd' */
  77.     unsigned long            offsetToData;        /* Offset into the file to where the data is */
  78.     unsigned long            dataSize;            /* Length of data */
  79.     unsigned long            dataFormat;            /* data format code */
  80.     unsigned long            sampleRate;            /* Samples per second */
  81.     unsigned long            numChannels;        /* 1 mono, 2 stereo */
  82.     unsigned char            info[4];            /* optional text info */
  83. }auHeader;
  84.  
  85. #if PRAGMA_ALIGN_SUPPORTED
  86. #pragma options align=reset
  87. #endif
  88.  
  89.         OSErr    ASoundGetULAWHeader        (SoundInfoPtr theSoundInfo,
  90.                                         long *dataStart,
  91.                                         long *length);
  92.  
  93. #define kULAWHeaderBufferSize 24
  94.  
  95. #endif
  96.